package com.douyinkan.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.time.LocalDateTime;

@TableName("view_history")
public class ViewHistory {
    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField("content_id")
    private Long contentId; // 存储content的ID而不是对象引用

    @TableField("viewed_at")
    private LocalDateTime viewedAt;

    // 构造函数
    public ViewHistory() {
        this.viewedAt = LocalDateTime.now();
    }

    public ViewHistory(Long contentId) {
        this.contentId = contentId;
        this.viewedAt = LocalDateTime.now();
    }

    // Getter和Setter方法
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getContentId() {
        return contentId;
    }

    public void setContentId(Long contentId) {
        this.contentId = contentId;
    }

    public LocalDateTime getViewedAt() {
        return viewedAt;
    }

    public void setViewedAt(LocalDateTime viewedAt) {
        this.viewedAt = viewedAt;
    }
}